Skip to content

(via EnkiP): fix(workflow-executor): restore field names in fetchXToOneCandidate befo#1611

Open
macroscopeapp[bot] wants to merge 1 commit into
fix/load-related-recordfrom
macroscope/fix/load-related-record
Open

(via EnkiP): fix(workflow-executor): restore field names in fetchXToOneCandidate befo#1611
macroscopeapp[bot] wants to merge 1 commit into
fix/load-related-recordfrom
macroscope/fix/load-related-record

Conversation

@macroscopeapp
Copy link
Copy Markdown

@macroscopeapp macroscopeapp Bot commented May 29, 2026

Summary

Fixes an issue where relations with underscores in their names (e.g., customer_order) would trigger spurious RelatedRecordNotFoundError when accessing them in the workflow executor.

Changes

  • Added a call to restoreFieldNames in fetchXToOneCandidate after retrieving the parent record from agentPort.getRecord
  • This converts camelCase keys (returned by agent-client) back to their original format (e.g., snake_case), ensuring relation fields are correctly accessed

Root Cause

The agent-client returns records with camelCase keys, but relation lookups were using the original field names (which may contain underscores). Without restoring the field names first, the relation key wouldn't match and the lookup would fail.

Note

Macroscope: Fix It For Me

  • This PR originated from this comment in fix: load related record #1610.
  • Since auto-merge is on, Macroscope will merge this PR after waiting for checks to pass.
  • If you'd rather not wait, you can always merge this yourself but no further action from you is currently needed.
  • You can also @mention Macroscope in this PR to request further changes.

Activity

Currently: Not merged: unstable

Previously
  • Waiting on checks
  • Action failed: Lint, Build, Test and Doc
  • Waiting on checks
  • Pushed eb2e978

Note

Fix relation field lookup in LoadRelatedRecordStepExecutor to handle snake_case field names

When resolving a related record, the parent record's values are fetched in camelCase but the relation target name uses the original schema field name (e.g., snake_case). This mismatch caused RelatedRecordNotFoundError to be thrown incorrectly for any relation whose name contains underscores.

The fix calls restoreFieldNames in load-related-record-step-executor.ts to map parent.values back to original schema field names before looking up target.name.

Risk: Each call to resolveFromSelection now performs an additional async schema fetch.

Macroscope summarized eb2e978.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant